<template>
    <el-drawer title="我是标题" :visible.sync="dialogVisible" :with-header="false" class="demand_box" size='50%' @close="resetForm()">
        <div class="flexbox flexcolumn height_100">
            <div class="demand_head flexbox flexcenter flexbetween">
                <span class="demand_title">{{name}}</span>
                <span class="icon_btn icon_btn_32" @click="resetForm()"><img src="../../assets/img/close_check.svg" alt=""></span>
            </div>
            <div class="flexbox flexcenter flexbetween pd_box">
                <el-input placeholder="请输入项目名称搜索" size="small" style="width:216px" clearable @change="getDataList(1)" prefix-icon="el-icon-search" v-model="queryInfo.query">
                </el-input>
                <el-date-picker style="width:240px" value-format="yyyy-MM-dd" v-model="queryInfo.date" @change="getDataList(1)" size="small" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期">
                </el-date-picker>
            </div>
            <div class="demand_center flex" v-loading="loading" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0)">
                <el-table :data="tableData" class="com_table" height="100%">
                    <el-table-column prop="ad_id" label="计划ID">
                    </el-table-column>
                    <el-table-column prop="advertiser_id" label="账户ID">
                    </el-table-column>
                    <el-table-column prop="create_time" label="触发时间" width="180">
                    </el-table-column>
                </el-table>
            </div>
            <div class="demand_footer flexbox flexcenter">
                <el-pagination background layout="total, prev, pager, next,sizes" @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="queryInfo.page" :page-size="queryInfo.limit" :page-sizes="[20, 50, 100, 200]" :total="total">
                </el-pagination>
            </div>
        </div>
    </el-drawer>
</template>

<script>
export default {
    name: "",
    data() {
        return {
            name: null,
            loading: false,
            dialogVisible: false,
            queryInfo: {
                pro_id: "",
                page: 1,
                limit: 20,
                query: "",
                date: [],
            },
            tableData: [],
            total: 0,
        };
    },
    created() {},

    methods: {
        getData(value) {
            this.dialogVisible = true;
            this.name = value.name;
            this.queryInfo.pro_id = value.id;
            this.getDataList(1);
        },
        //获取
        async getDataList(page) {
            this.queryInfo.page = page;
            this.loading = true;
            const { data: res } = await this.$http.post(
                "videotest/Probject/cleanPlanInfo",
                this.queryInfo
            );
            if (res.code !== 200) {
                this.loading = false;
                this.$message.error(res.msg);
                return;
            } else {
                this.loading = false;
                this.total = res.data.count
                this.tableData = res.data.list;
            }
        },

        // 关闭重置表单
        resetForm() {
            this.tableData = [];
            this.queryInfo.page = 1
            this.dialogVisible = false;
        },

        // 每页显示多少条数据
        handleSizeChange(val) {
            this.queryInfo.limit = val;
            this.getDataList(1);
        },
        // 当前页切换
        handleCurrentChange(val) {
            this.setpage = val;
            this.getDataList(val);
        },
    },
    components: {},
};
</script>


<style scoped>
.pd_box{
    padding: 20px 20px 0;
}
</style>
